/**
 * 解释器，包装了 BeanShell 的解释器
 */
package cn.antia.cep.common;

import bsh.Interpreter;
/**
 * @author sunkeei
 *
 */
public class AntiaInterpreter {
	private static Interpreter interpreter = new Interpreter();

    /**
     * 动态执行JAVA表达式，返回Boolean/Integer/Double
     * @param expression java expression
     * @return Object
     */
	public static Object eval(String expression){
		try{
			return interpreter.eval(expression);
		}catch(Exception e){
			e.printStackTrace();
			AntiaLog.error("expression:" + expression);
			return null;
		}
	}
}
